<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OA模拟与实现</title>
    <link rel="stylesheet" th:href="@{/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css}"></link>
    <script th:src="@{~/js/jquery-3.2.1.min.js}"></script>
    <style>
      .tb{
          margin-top: 10px;
      }
    </style>
</head>
<script>
    $(function(){
        $("#select").click(function(){
            var num = $("#snumber").val();
            var reg = /^[0-9]+$/
            if(reg.test(num)){
                var href = $(this).attr("href");
                $(this).attr("href",href+"?sid="+num);
            }else{
                stop();
            }

        })
    })
</script>
<body>
    <div class="container-fluid">
        <ol class="breadcrumb nav-top">
            <li><a th:href="@{~/router/index.html}" target="main">首页</a></li>
            <li class="active">学生管理</li>
        </ol>
        <form class="form-inline" >
            <div class="form-group">
                <label for="snumber">学号：</label>
                <input type="text" class="form-control" id="snumber" placeholder="请输入学号">
            </div>
            <a href="/student/student.html" id="select" class="btn btn-primary">查询</a><b>|</b>
            <a href="/student/toAddStudent" id="add" class="btn btn-primary">添加学生</a>
        </form>
        <table class="table table-striped tb">
            <thead>
            <tr class="text-center">
                <td>学&nbsp;号</td>
                <td>姓&nbsp;名</td>
                <td>入学日期</td>
                <td>系&nbsp;部</td>
                <td>专&nbsp;业</td>
                <td>辅导员</td>
                <td>操&nbsp;作</td>
            </tr>
            </thead>
            <tbody>
            <tr class="text-center" th:object="${student}" th:each=" student : ${studentList}">
                <td th:text="*{sid}">201926501</td>
                <td th:text="*{sname}">小花</td>
                <td th:text="*{#dates.format(sintime,'yyyy-MM-dd')}">2019-9-1</td>
                <td th:text="*{domain.domainname}">信息工程学院</td>
                <td th:text="*{depart.major}">计算机科学与技术</td>
                <td th:text="*{people.oname}">jary</td>
                <td>
                    <a th:href="@{/student/detail/{sid}(sid=*{sid})}">详情</a>
                    <span th:if="${session.people.oauth==1}">&nbsp;|&nbsp;<a th:href="@{/student/toEdit/{sid}(sid=*{sid})}">修改</a></span>
                </td>
            </tr>
            </tbody>

        </table>
        <div class="text-center">
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li>
                        <a th:href="@{/student/student.html(currentPage=${currentPage == 1? 1:currentPage - 1},sid=${sid})}" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>

                    <li th:each="num : ${#numbers.sequence(1,totalPage)}"><a th:href="@{/student/student.html(currentPage=${num},sid=${sid})}" th:text="${num}">1</a></li>

                    <li>
                        <a th:href="@{/student/student.html(currentPage=${currentPage == totalPage?totalPage:currentPage + 1},sid=${sid})}" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <!--<button id="btn">刷星</button>-->
        <!--<script>-->
            <!--$(function(){-->
                <!--$("#btn").click(function(){-->
                    <!--window.location.reload("/student/student.html");-->
                <!--})-->
            <!--})-->
        <!--</script>-->
    </div>
</body>
</html>